cover = ->
	win_height = undefined
	win_height = $(window).height()
	if win_height < 450
		$(".bg").height 450
	else
		$(".bg").height win_height
	return

window.onscroll = ->
	t = undefined
	win_height = undefined
	t = document.documentElement.scrollTop or document.body.scrollTop
	win_height = $(window).height()
	if t > win_height - 1
		$("#mynav").show()
	else
		$("#mynav").hide()

$("#scrollUp").on "click", (e) ->
	$("body,html").animate
		scrollTop: 0
	, 400
	return

$('.notinview').one "inview", (e, isInView, visiblePartX, visiblePartY) ->
	if isInView
		fadeDiv = $(this)
		setTimeout (-> fadeDiv.fadeTo(600, 1)), 800

$("#mynav").hide()
cover()
$(window).resize -> cover()
